package com.ukao.pad.bean;

import android.os.Parcel;
import android.os.Parcelable;
import java.util.List;

/**
 * Created by ukaodev on 2017/8/9.
 */

public class PayInfoBean extends  BaseBean<PayInfoBean> implements Parcelable {

        /**
         * carriage : 1000
         * isEnableWx : true
         * isEnableAli : true
         * payablePrice : 18300
         * isEnableUnion : true
         * discount : 20
         * orderPrice : 1000
         * isEnableCash : true
         * userId : 114
         * modifyPrice : 18300
         */
        private  String   orderId ;
        private int carriage;
        private boolean isEnableWx;
        private boolean isEnableAli;
        private int payablePrice;
        private boolean isEnableUnion;
        private int discount;
        private int orderPrice;
        private boolean isEnableCash;
        private String userId;
        private Integer modifyPrice;
    private   int  balance;
    private   int payBalance;
    private   int  shouldPrice;
    private  int  couponAmt;/*使用的优惠券金额(如果有就返回)*/
    private Integer cpnUseBalance;  //是否可以使用余额
    private  String  cpnRelId;  /*优惠券ID*/
    private    boolean  isUseUPay=false; /*是否使用优付卡*/
    private boolean  isEnableOther; /*是否支持其实支付  多种卡支付*/
    private UPayCardBean uPayCard; /*优付款*/
    public void setUseUPay(boolean useUPay) {
        isUseUPay = useUPay;
    }
    public boolean isUseUPay() {
        return isUseUPay;
    }

    private List<PaySignListBean> paySignList;  /*银行卡列表*/

    public List<PaySignListBean> getPaySignList() {
        return paySignList;
    }
    public boolean isEnableOther() {
        return isEnableOther;
    }
    public UPayCardBean getUPayCard() {
        return uPayCard;
    }

    public void setUPayCard(UPayCardBean uPayCard) {
        this.uPayCard = uPayCard;
    }

    public String getCpnRelId() {
        return cpnRelId;
    }

    public void setCpnRelId(String cpnRelId) {
        this.cpnRelId = cpnRelId;
    }

    public Integer getCpnUseBalance() {
        if(cpnUseBalance==null){
            this.cpnUseBalance=1;
            return cpnUseBalance;
        }else {
            return cpnUseBalance;
        }
    }

    public void setCpnUseBalance(Integer cpnUseBalance) {
        this.cpnUseBalance = cpnUseBalance;

    }

    public void setCouponAmt(int couponAmt) {
        this.couponAmt = couponAmt;
    }

    public int getShouldPrice() {
        shouldPrice =shouldPrice<0?0:  shouldPrice;
        return  shouldPrice;
    }
    public void setShouldPrice(int shouldPrice) {
        this.shouldPrice = shouldPrice;
    }
    public int getBalance() {
        return balance;
    }

    public void setPayBalance(int payBalance) {
        this.payBalance = payBalance;
    }

    public int getPayBalance() {
        return payBalance;
    }

    public int getCouponAmt() {
        return couponAmt;
    }
    public String getOrderId() {
        return orderId;
    }

    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }

    public int getCarriage() {
            return carriage;
        }

        public void setCarriage(int carriage) {
            this.carriage = carriage;
        }

        public boolean isIsEnableWx() {
            return isEnableWx;
        }

        public void setIsEnableWx(boolean isEnableWx) {
            this.isEnableWx = isEnableWx;
        }

        public boolean isIsEnableAli() {
            return isEnableAli;
        }

        public void setIsEnableAli(boolean isEnableAli) {
            this.isEnableAli = isEnableAli;
        }

        public int getPayablePrice() {
            return payablePrice;
        }

        public void setPayablePrice(int payablePrice) {
            this.payablePrice = payablePrice;
        }

        public boolean isIsEnableUnion() {
            return isEnableUnion;
        }

        public void setIsEnableUnion(boolean isEnableUnion) {
            this.isEnableUnion = isEnableUnion;
        }

        public int getDiscount() {
            return discount;
        }

        public void setDiscount(int discount) {
            this.discount = discount;
        }

        public int getOrderPrice() {
            return orderPrice;
        }

        public void setOrderPrice(int orderPrice) {
            this.orderPrice = orderPrice;
        }

        public boolean isIsEnableCash() {
            return isEnableCash;
        }

        public void setIsEnableCash(boolean isEnableCash) {
            this.isEnableCash = isEnableCash;
        }

        public String getUserId() {
            return userId;
        }

        public void setUserId(String userId) {
            this.userId = userId;
        }

        public Integer getModifyPrice() {
            return modifyPrice;
        }

        public void setModifyPrice(int modifyPrice) {
            this.modifyPrice = modifyPrice;
        }

    public static class UPayCardBean   implements Parcelable {

        /**
         * timeEnable : 0
         * balance : 1120
         * userCardRelId : 140
         * payRatio : 80
         * useCoupon : 1
         * rfidId : 308288
         * isEnable : 1
         * name : 优付卡支付
         */
        private int timeEnable;
        private int balance;
        private int userCardRelId;
        private int payRatio;
        private int useCoupon;
        private int rfidId;
        private int isEnable;
        private String name;

        public int getTimeEnable() {
            return timeEnable;
        }

        public void setTimeEnable(int timeEnable) {
            this.timeEnable = timeEnable;
        }

        public int getBalance() {
            return balance;
        }


        public int getUserCardRelId() {
            return userCardRelId;
        }

        public void setUserCardRelId(int userCardRelId) {
            this.userCardRelId = userCardRelId;
        }

        public int getPayRatio() {
            return payRatio;
        }

        public void setPayRatio(int payRatio) {
            this.payRatio = payRatio;
        }

        public boolean getUseCoupon() {  /*1代表可以使用优惠卷*/
            if (useCoupon==1){
                return true;
            }
            return false;
        }

        public void setUseCoupon(int useCoupon) {
            this.useCoupon = useCoupon;
        }

        public int getRfidId() {
            return rfidId;
        }

        public void setRfidId(int rfidId) {
            this.rfidId = rfidId;
        }

        public boolean getIsEnable() {
            if (isEnable==1){
                return  true;
            }
            return false;
        }

        public void setIsEnable(int isEnable) {
            this.isEnable = isEnable;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeInt(this.timeEnable);
            dest.writeInt(this.balance);
            dest.writeInt(this.userCardRelId);
            dest.writeInt(this.payRatio);
            dest.writeInt(this.useCoupon);
            dest.writeInt(this.rfidId);
            dest.writeInt(this.isEnable);
            dest.writeString(this.name);
        }

        public UPayCardBean() {
        }

        protected UPayCardBean(Parcel in) {
            this.timeEnable = in.readInt();
            this.balance = in.readInt();
            this.userCardRelId = in.readInt();
            this.payRatio = in.readInt();
            this.useCoupon = in.readInt();
            this.rfidId = in.readInt();
            this.isEnable = in.readInt();
            this.name = in.readString();
        }

        public static final Creator<UPayCardBean> CREATOR = new Creator<UPayCardBean>() {
            @Override
            public UPayCardBean createFromParcel(Parcel source) {
                return new UPayCardBean(source);
            }

            @Override
            public UPayCardBean[] newArray(int size) {
                return new UPayCardBean[size];
            }
        };
    }
    public static class  PaySignListBean implements Parcelable {

        private String val;
        private String showName;
        private String name;


        public String getVal() {
            return val;
        }

        public void setVal(String val) {
            this.val = val;
        }

        public String getShowName() {
            return showName;
        }

        public void setShowName(String showName) {
            this.showName = showName;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.val);
            dest.writeString(this.showName);
            dest.writeString(this.name);
        }

        public PaySignListBean() {
        }

        protected PaySignListBean(Parcel in) {
            this.val = in.readString();
            this.showName = in.readString();
            this.name = in.readString();
        }

        public static final Creator<PaySignListBean> CREATOR = new Creator<PaySignListBean>() {
            @Override
            public PaySignListBean createFromParcel(Parcel source) {
                return new PaySignListBean(source);
            }

            @Override
            public PaySignListBean[] newArray(int size) {
                return new PaySignListBean[size];
            }
        };
    }
    public PayInfoBean() {
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.orderId);
        dest.writeInt(this.carriage);
        dest.writeByte(this.isEnableWx ? (byte) 1 : (byte) 0);
        dest.writeByte(this.isEnableAli ? (byte) 1 : (byte) 0);
        dest.writeInt(this.payablePrice);
        dest.writeByte(this.isEnableUnion ? (byte) 1 : (byte) 0);
        dest.writeInt(this.discount);
        dest.writeInt(this.orderPrice);
        dest.writeByte(this.isEnableCash ? (byte) 1 : (byte) 0);
        dest.writeString(this.userId);
        dest.writeValue(this.modifyPrice);
        dest.writeInt(this.balance);
        dest.writeInt(this.payBalance);
        dest.writeInt(this.shouldPrice);
        dest.writeInt(this.couponAmt);
        dest.writeValue(this.cpnUseBalance);
        dest.writeString(this.cpnRelId);
        dest.writeByte(this.isUseUPay ? (byte) 1 : (byte) 0);
        dest.writeByte(this.isEnableOther ? (byte) 1 : (byte) 0);
        dest.writeParcelable(this.uPayCard, flags);
        dest.writeTypedList(this.paySignList);
    }

    protected PayInfoBean(Parcel in) {
        this.orderId = in.readString();
        this.carriage = in.readInt();
        this.isEnableWx = in.readByte() != 0;
        this.isEnableAli = in.readByte() != 0;
        this.payablePrice = in.readInt();
        this.isEnableUnion = in.readByte() != 0;
        this.discount = in.readInt();
        this.orderPrice = in.readInt();
        this.isEnableCash = in.readByte() != 0;
        this.userId = in.readString();
        this.modifyPrice = (Integer) in.readValue(Integer.class.getClassLoader());
        this.balance = in.readInt();
        this.payBalance = in.readInt();
        this.shouldPrice = in.readInt();
        this.couponAmt = in.readInt();
        this.cpnUseBalance = (Integer) in.readValue(Integer.class.getClassLoader());
        this.cpnRelId = in.readString();
        this.isUseUPay = in.readByte() != 0;
        this.isEnableOther = in.readByte() != 0;
        this.uPayCard = in.readParcelable(UPayCardBean.class.getClassLoader());
        this.paySignList = in.createTypedArrayList(PaySignListBean.CREATOR);
    }

    public static final Creator<PayInfoBean> CREATOR = new Creator<PayInfoBean>() {
        @Override
        public PayInfoBean createFromParcel(Parcel source) {
            return new PayInfoBean(source);
        }

        @Override
        public PayInfoBean[] newArray(int size) {
            return new PayInfoBean[size];
        }
    };
}
